package com.kudo.util;

public class FloatPoint {

    public float x, y;

    public FloatPoint() {
        this(0, 0);
    }

    public FloatPoint(FloatPoint p) {
        this(p.x, p.y);
    }

    public FloatPoint(float x, float y) {
        this.x = x;
        this.y = y;
    }

    public void translate(float dx, float dy) {
        this.x += dx;
        this.y += dy;
    }

    public float getX() {
        return x;
    }

    public void setX(float x) {
        this.x = x;
    }

    public float getY() {
        return y;
    }

    public void setY(float y) {
        this.y = y;
    }

    public void setLocation(float x, float y) {
        this.x = x;
        this.y = y;
    }

    public void setLocation(FloatPoint p) {
        setLocation(p.x, p.y);
    }

    public boolean equals(Object o) {
        if (o instanceof FloatPoint) {
            FloatPoint p = (FloatPoint) o;
            return p.x == this.x && p.y == this.y;
        } else {
            return false;
        }
    }

    public Object clone() {
        return new FloatPoint(this);
    }

    public String toString() {
        return this.getClass() + "[x=" + x + ", y=" + y + "]";
    }
}